<?php /* Smarty version 2.6.21, created on 2009-07-21 18:46:24
         compiled from products_edit.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'escape', 'products_edit.tpl', 14, false),)), $this); ?>
<div class="form">
<FORM method="post" action="/backend/products/save/">
    <H1><?php if ($this->_tpl_vars['Products']->isNew()): ?>Добавление продукта<?php else: ?>Редактирование продукта '<?php echo $this->_tpl_vars['Products']->title; ?>
'<?php endif; ?></H1>
    <div class="operation">
    	<a href="<?php echo $this->_tpl_vars['fvConfig']->get('dir_web_root'); ?>
news/" onclick="go('<?php echo $this->_tpl_vars['fvConfig']->get('dir_web_root'); ?>
news/'); return false;" class="left">вернутся к списку</a>
    	<div style="clear: both;"></div>
    </div>
    <div style="width: 90%; float: left;">
    <fieldset>
        <legend>Общая информация</legend>
   		<table>
        	<tr>
        		<td><label for="title">Название:</label></td>
        		<td><input type="text" id="title" name="n[title]" value="<?php echo ((is_array($_tmp=$this->_tpl_vars['Products']->title)) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?>
"/></td>
        	</tr>
        	<tr>
        		<td><label for="price">Цена (за 100г):</label></td>
        		<td><input type="text" id="price" name="n[price]" value="<?php echo ((is_array($_tmp=$this->_tpl_vars['Products']->price)) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?>
"/></td>
        	</tr>
        	<tr>
        		<td><label for="country">Страна производитель:</label></td>
        		<td><input type="text" id="country" name="n[country]" value="<?php echo ((is_array($_tmp=$this->_tpl_vars['Products']->country)) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?>
"/></td>
        	</tr>
        	<tr>
        		<td><label for="artikul">Артикул:</label></td>
        		<td><input type="text" id="artikul" name="n[artikul]" value="<?php echo ((is_array($_tmp=$this->_tpl_vars['Products']->artikul)) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)); ?>
"/></td>
        	</tr>
        	<tr>
        		<td colspan="2"><label for="description">Описание:</label><?php echo $this->_tpl_vars['editor']; ?>
</td>
        	</tr>
	    	</table>
    </fieldset>
    <div class="buttonpanel">
        <input type="submit" name="save" value="Сохранить" class="button"  onclick="$('redirect').value = '';">
        <input type="submit" name="save_and_return" value="Сохранить и выйти" class="button" onclick="$('redirect').value = '1';">
    </div>
    <input type="hidden" name="id" id="id" value="<?php echo $this->_tpl_vars['Products']->getPk(); ?>
" />
    <input type="hidden" name="n[image]" id="image" value="<?php echo $this->_tpl_vars['Products']['image']; ?>
" />
    <input type="hidden" id="redirect" name="redirect" value="" />
    </div>
	<div style="float: left; margin-left: 10px;">
	</div>
<div style="clear: both;" />
</div>
</form>
<form method="post" action="<?php echo $this->_tpl_vars['fvConfig']->get('dir_web_root'); ?>
products/uploadimage"  enctype="multipart/form-data" id="products_upload_form">
    <fieldset>
        <legend>Изображение</legend>

        <table class="form">
        <tr><td style="width: 1px;">
        <label for="type">Изображение товара</label></td><td>
            <input type="file" name="image" style="width:500px">
        </td><td>
            <input type="submit" name="save" value="загрузить" class="button">
        </td></tr>
        </table>
        
    </fieldset>
    <iframe name="products_upload_frame" id="products_upload_frame" src="javascript:void(0);" style="display: none;">
    </iframe>
    
	<div id="products_upload_preview" style="text-align: center; <?php if (! $this->_tpl_vars['Products']->hasFile('image','small')): ?>display: none;<?php endif; ?>">
    	<?php if ($this->_tpl_vars['Products']->hasFile('image','small')): ?>
        	<img id="products_upload_img" <?php echo $this->_tpl_vars['Products']->getImageSize('image','small'); ?>
 style="border: 0px solid none;" src="<?php echo $this->_tpl_vars['Products']->getImageDir(true); ?>
<?php echo $this->_tpl_vars['Products']->getImageName('image','small'); ?>
" /><br />
            <a href="javascript: void(0);" id="products_upload_delete" style="font-size: 12px; color: blue; text-decoration: underline;">удалить</a>
        <?php else: ?>
        	<img id="products_upload_img" width="<?php echo $this->_tpl_vars['fvConfig']->get('images.small.width'); ?>
" style="border: 0px none;" src="" /><br />
            <a href="javascript: void(0);" id="products_upload_delete" style="font-size: 12px; color: blue; text-decoration: underline;">удалить</a>
        <?php endif; ?> 
    </div>
</form>
</div>
<script>
	new UploadPanel('products_upload', '<?php echo $this->_tpl_vars['fvConfig']->get('dir_web_root'); ?>
products/deleteImage');
	<?php echo '
    Object.extend(window, {
        updateImage: function (imageName, width, height) {
            if ($(\'products_upload_img\')) {
                $(\'products_upload_img\').src = \''; ?>
<?php echo $this->_tpl_vars['fvConfig']->get('path.upload.web_tmp_dir'); ?>
<?php echo '\' + imageName;
                $(\'products_upload_img\').width = width;
                $(\'products_upload_img\').height = height;
            }
            $(\'image\').value = imageName;
            if (imageName != \'\'){
                $(\'products_upload_preview\').show();
            }
            else 
                $(\'products_upload_preview\').hide();
        }
    });

    '; ?>

</script>